<template>
  <div style="padding: 20px">
    <el-tabs type="border-card" @tab-click="handleClick">
      <el-tab-pane label="充值榜" class="tab_cz tab_pane">
        <!-- 搜索栏 -->
        <div class="block">
          <span class="demonstration">充值时间 </span>
          <el-date-picker
            v-model="time"
            size="mini"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
          <!-- <span>
            充值金额
            <el-input
              type="text"
              size="mini"
              v-model="amountMoney"
              placeholder="请输入金额"
              style="width: 10%"
            ></el-input
          ></span> -->
          <span
            >VIP状态
            <el-select size="mini" v-model="vip" placeholder="请选择">
              <el-option
                v-for="item in VIP"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option> </el-select
          ></span>
          <span
            >排序方式
            <el-select size="mini" v-model="sort" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option> </el-select
          ></span>
          <span>
            <el-button type="primary" @click="go('充值榜')">搜索</el-button>
          </span>
          <span>
            <el-button @click="exportExcel('充值榜')">导出Excel</el-button>
          </span>
          <span>
            <el-button @click="exportUserId('充值榜')">导出用户id</el-button>
          </span>
        </div>
        <!-- 表格 -->
        <el-table v-loading="loading" :data="tableData" style="width: 100%">
          <el-table-column prop="id_code" label="用户id" width="180">
          </el-table-column>
          <el-table-column prop="nick_name" label="用户昵称" width="180">
          </el-table-column>
          <el-table-column prop="create_time" label="注册时间">
          </el-table-column>
          <el-table-column prop="vip" label="是否为VIP"> </el-table-column>
          <el-table-column prop="pay_amount" label="充值金额">
          </el-table-column>
          <el-table-column prop="goldcoin" label="充值金币数">
          </el-table-column>
          <el-table-column prop="gold" label="消耗金币数"> </el-table-column>
          <el-table-column prop="is_del" label="账号状态"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="details(scope.row)"
                >详情</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="page"
          :limit.sync="pageSize"
          @pagination="getList"
        />
      </el-tab-pane>
      <el-tab-pane label="收入榜" class="tab_pane">
        <!-- 搜索栏 -->
        <div class="block">
          <span class="demonstration">提现时间 </span>
          <el-date-picker
            v-model="incomeTime"
            size="mini"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>

          <!-- <span>
            提现金额
            <el-input
              size="mini"
              v-model="incomeAmountMoney"
              placeholder="请输入金额"
              style="width: 10%"
            ></el-input
          ></span> -->
          <span
            >VIP状态
            <el-select size="mini" v-model="incomeValue" placeholder="请选择">
              <el-option
                v-for="item in incomeVIP"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option> </el-select
          ></span>
          <span
            >排序方式
            <el-select size="mini" v-model="incomeSrot" placeholder="请选择">
              <el-option
                v-for="item in incomeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option> </el-select
          ></span>
          <span>
            <el-button type="primary" @click="go('收入榜')">搜索</el-button>
          </span>
          <span>
            <el-button @click="exportExcel('收入榜')">导出Excel</el-button>
          </span>
          <span>
            <el-button @click="exportUserId('收入榜')">导出用户id</el-button>
          </span>
        </div>
        <!-- 表格 -->
        <el-table
          v-loading="incomeLoading"
          :data="incomeTableData"
          style="width: 100%"
        >
          <el-table-column prop="id_code" label="用户id" width="180">
          </el-table-column>
          <el-table-column prop="nick_name" label="用户昵称" width="180">
          </el-table-column>
          <el-table-column prop="create_time" label="注册时间">
          </el-table-column>
          <el-table-column prop="vip" label="是否为VIP"> </el-table-column>
          <el-table-column prop="amount" label="提现金额"> </el-table-column>
          <el-table-column prop="diamond" label="获得宝石数"> </el-table-column>
          <el-table-column prop="gold" label="消耗宝石数"> </el-table-column>
          <el-table-column prop="is_del" label="账号状态"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="details(scope.row)"
                >详情</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="incomeTotal > 0"
          :total="incomeTotal"
          :page.sync="incomePage"
          :limit.sync="incomePageSize"
          @pagination="incomeGetList"
        />
      </el-tab-pane>
      <el-tab-pane label="拉新榜" class="tab_pane">
        <!-- 搜索栏 -->
        <div class="block">
          <span class="demonstration">拉新时间 </span>

          <el-date-picker
            v-model="newTime"
            type="daterange"
            align="right"
            size="mini"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>

          <!-- <span>
            拉新人数
            <el-input
              size="mini"
              v-model="newAmountMoney"
              placeholder="请输入人数"
              style="width: 10%"
            ></el-input
          ></span> -->
          <span
            >VIP状态
            <el-select size="mini" v-model="newValue" placeholder="请选择">
              <el-option
                v-for="item in newVIP"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option> </el-select
          ></span>
          <span
            >排序方式
            <el-select size="mini" v-model="newSrot" placeholder="请选择">
              <el-option
                v-for="item in newOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option> </el-select
          ></span>
          <span>
            <el-button type="primary" @click="go('拉新榜')">搜索</el-button>
          </span>
          <span>
            <el-button @click="exportExcel('拉新榜')">导出Excel</el-button>
          </span>
          <span>
            <el-button @click="exportUserId('拉新榜')">导出用户id</el-button>
          </span>
        </div>

        <!-- 表格 -->
        <div class="sex">
          <div :class="{ active: index == 1 }" @click="handleClickSex(1)">
            男
          </div>
          <div :class="{ active: index == 2 }" @click="handleClickSex(2)">
            女
          </div>
        </div>
        <el-table
          v-loading="newLoading"
          :data="newTableData"
          style="width: 100%"
        >
          <el-table-column prop="id_code" label="用户id" width="180">
          </el-table-column>
          <el-table-column prop="nick_name" label="用户昵称" width="180">
          </el-table-column>
          <el-table-column prop="create_time" label="注册时间">
          </el-table-column>
          <el-table-column prop="vip" label="是否为VIP"> </el-table-column>
          <el-table-column prop="num" label="拉新人数" v-if="index == 1">
          </el-table-column>
          <el-table-column
            prop="one_parent_id"
            label="一级代理"
            v-if="index == 2"
          >
          </el-table-column>
          <el-table-column
            prop="two_parent_id"
            label="二级代理"
            v-if="index == 2"
          >
          </el-table-column>
          <el-table-column prop="code" label="邀请码"> </el-table-column>
          <el-table-column prop="gold" label="获得金币" v-if="index == 1">
          </el-table-column>
          <el-table-column prop="diamond" label="获得宝石" v-if="index == 2">
          </el-table-column>
          <el-table-column prop="is_del" label="账号状态"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="details(scope.row)"
                >详情</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="newTotal > 0"
          :total="newTotal"
          :page.sync="newPage"
          :limit.sync="newPageSize"
          @pagination="newGetList"
        />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import Pagination from "@/components/Pagination"; // 分页
import {
  userRechargeList,
  userWithdrawal,
  userProreword,
} from "@/api/UserManagement";
import moment from "moment";
export default {
  components: { Pagination },
  data() {
    return {
      loading: true,
      incomeLoading: true,
      newLoading: true,
      amountMoney: "",
      index: 1,
      //   tabPosition: "nan",
      total: 0,
      tableData: [],
      //   收入榜数据
      incomeTotal: 0,
      incomePage: 1,
      incomePageSize: 10,
      incomeTableData: [],
      incomeTime: "",
      incomeAmountMoney: "",
      incomeValue: "",
      incomeSrot: "",
      incomeStartTime: "",
      incomeEndTime: "",
      incomeSort: "",
      incomeVip: "",
      //   拉新榜数据
      newTotal: 0,
      newPage: 1,
      newPageSize: 10,
      newTableData: [],
      newTime: "",
      newAmountMoney: "",
      newValue: "",
      newSrot: "",
      newStartTime: "",
      newEndTime: "",
      newSort: "",
      newVip: "",
      sex: 1,
      VIP: [
        {
          value: "",
          label: "不限",
        },
        {
          value: "1",
          label: "是",
        },
        {
          value: "0",
          label: "否",
        },
      ],
      options: [
        {
          value: "",
          label: "不限",
        },
        {
          value: "1",
          label: "充值金额降序",
        },
        {
          value: "2",
          label: "消耗金币降序",
        },
      ],
      newVIP: [
        {
          value: "",
          label: "不限",
        },
        {
          value: "1",
          label: "是",
        },
        {
          value: "0",
          label: "否",
        },
      ],
      newOptions: [
        {
          value: "",
          label: "不限",
        },
        {
          value: "1",
          label: "拉新人数降序",
        },
        {
          value: "2",
          label: "获得收益降序",
        },
      ],
      incomeVIP: [
        {
          value: "",
          label: "不限",
        },
        {
          value: "1",
          label: "是",
        },
        {
          value: "0",
          label: "否",
        },
      ],
      incomeOptions: [
        {
          value: "",
          label: "不限",
        },
        {
          value: "1",
          label: "提现金额降序",
        },
        {
          value: "2",
          label: "获得宝石降序",
        },
      ],

      value: "",
      startTime: "", //开始时间
      endTime: "", //结束时间
      page: 1,
      pageSize: 10,

      sort: "",
      vip: "",
      activeName: "first",
      type: 1,
      pickerOptions: {
        disabledDate(platformValue) {
          return platformValue.getTime() > Date.now() - 8.64e6;
        },
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      time: "",
    };
  },
  watch: {
    time() {
      if (this.time == null) {
        this.time = [];
      }
    },
    incomeTime() {
      if (this.incomeTime == null) {
        this.incomeTime = [];
      }
    },
    newTime() {
      if (this.newTime == null) {
        this.newTime = [];
      }
    },
  },
  created() {
    this.Recharge();
  },
  methods: {
    exportExcel(name) {
      if (name == "充值榜") {
        userRechargeList({
          page: this.page,
          pageSize: this.total,
          vip: this.vip,
          startTime: this.startTime,
          endTime: this.endTime,
          sort: this.sort,
        }).then((res) => {
          // console.log(res);
          res.data.list.forEach((item) => {
            item.vip = item.vip == 0 ? "否" : "是";
            // item.create_time = moment().format("YYYY-MM-DD");
            item.create_time = moment(parseInt(item.create_time) * 1000).format(
              "YYYY-MM-DD HH:mm:ss"
            );

            item.is_del =
              item.is_del == "0"
                ? "正常"
                : item.is_del == "1"
                ? "封禁"
                : "删除"; //0 正常 1封禁 2删除
          });
          // console.log(arr);
          const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
          const tHeader = [
            "用户id",
            "用户昵称",
            "注册时间",
            "是否为vip",
            "充值金额",
            "充值金币数",
            "消耗金币数",
            "账号状态",
          ];
          const filterVal = [
            "id_code",
            "nick_name",
            "create_time",
            "vip",
            "pay_amount",
            "goldcoin",
            "gold",
            "is_del",
          ];
          // console.log(arr);
          const list = res.data.list;
          const data = this.formatJson(filterVal, list);
          export_json_to_excel(tHeader, data, "充值榜数据"); //最后一个是表名字
        });
      } else if (name == "收入榜") {
        userWithdrawal({
          page: this.incomePage,
          pageSize: this.incomeTotal,
          vip: this.incomeValue,
          startTime: this.incomeStartTime,
          endTime: this.incomeEndTime,
          sort: this.incomeSrot,
        }).then((res) => {
          // console.log(res);
          if (res.code == 0) {
            res.data.list.forEach((item) => {
              item.vip = item.vip == 0 ? "否" : "是";
              // item.create_time = moment().format("YYYY-MM-DD");
              item.create_time = moment(
                parseInt(item.create_time) * 1000
              ).format("YYYY-MM-DD HH:mm:ss");

              item.is_del =
                item.is_del == "0"
                  ? "正常"
                  : item.is_del == "1"
                  ? "封禁"
                  : "删除"; //0 正常 1封禁 2删除
            });
            const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
            const tHeader = [
              "用户id",
              "用户昵称",
              "注册时间",
              "是否为vip",
              "提现金额",
              "获得宝石数",
              "消耗宝石",
              "账号状态",
            ];
            const filterVal = [
              "id_code",
              "nick_name",
              "create_time",
              "vip",
              "amount",
              "diamond",
              "gold",
              "is_del",
            ];
            const list = res.data.list;
            const data = this.formatJson(filterVal, list);
            export_json_to_excel(tHeader, data, "收入榜数据"); //最后一个是表名字
          }
        });
      } else if (name == "拉新榜") {
        if (this.sex == 1) {
          userProreword({
            page: this.newPage,
            pageSize: this.newTotal,
            vip: this.newValue,
            startTime: this.newStartTime,
            endTime: this.newEndTime,
            sort: this.newSrot,
            sex: 1,
          }).then((res) => {
            // console.log(res);
            if (res.code == 0) {
              res.data.list.forEach((item) => {
                item.vip = item.vip == 0 ? "否" : "是";
                // item.create_time = moment().format("YYYY-MM-DD");
                item.create_time = moment(
                  parseInt(item.create_time) * 1000
                ).format("YYYY-MM-DD HH:mm:ss");

                item.is_del =
                  item.is_del == "0"
                    ? "正常"
                    : item.is_del == "1"
                    ? "封禁"
                    : "删除"; //0 正常 1封禁 2删除
              });
              const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
              const tHeader = [
                "用户id",
                "用户昵称",
                "注册时间",
                "是否为vip",
                "拉新人数",
                "邀请码",
                "获得金币",
                "账号状态",
              ];
              const filterVal = [
                "id_code",
                "nick_name",
                "create_time",
                "vip",
                "num",
                "code",
                "gold",
                "is_del",
              ];
              const list = res.data.list;
              const data = this.formatJson(filterVal, list);
              export_json_to_excel(tHeader, data, "拉新榜男数据"); //最后一个是表名字
            }
          });
        } else {
          userProreword({
            page: this.newPage,
            pageSize: this.newTotal,
            vip: this.newValue,
            startTime: this.newStartTime,
            endTime: this.newEndTime,
            sort: this.newSrot,
            sex: 2,
          }).then((res) => {
            if (res.code == 0) {
              res.data.list.forEach((item) => {
                item.vip = item.vip == 0 ? "否" : "是";
                // item.create_time = moment().format("YYYY-MM-DD");
                item.create_time = moment(
                  parseInt(item.create_time) * 1000
                ).format("YYYY-MM-DD HH:mm:ss");

                item.is_del =
                  item.is_del == "0"
                    ? "正常"
                    : item.is_del == "1"
                    ? "封禁"
                    : "删除"; //0 正常 1封禁 2删除
              });
              const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
              const tHeader = [
                "用户id",
                "用户昵称",
                "注册时间",
                "是否为vip",
                "一级代理",
                "二级代理",
                "邀请码",
                "获得宝石",
                "账号状态",
              ];
              const filterVal = [
                "id_code",
                "nick_name",
                "create_time",
                "vip",
                "one_parent_id",
                "two_parent_id",
                "code",
                "diamond",
                "is_del",
              ];
              const list = res.data.list;
              const data = this.formatJson(filterVal, list);
              export_json_to_excel(tHeader, data, "拉新榜女数据"); //最后一个是表名字
            }
          });
        }
      }
    },
    // 导出用户id
    exportUserId(name) {
      if (name == "充值榜") {
        userRechargeList({
          page: this.page,
          pageSize: this.total,
          vip: this.vip,
          startTime: this.startTime,
          endTime: this.endTime,
          sort: this.sort,
        }).then((res) => {
          // console.log(res);
          if (res.code == 0) {
            require.ensure([], () => {
              const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
              const tHeader = ["用户id"];
              const filterVal = ["id_code"];
              const list = res.data.list;
              const data = this.formatJson(filterVal, list);
              export_json_to_excel(tHeader, data, "充值榜用户id"); //最后一个是表名字
            });
          }
        });
      } else if (name == "收入榜") {
        userWithdrawal({
          page: this.incomePage,
          pageSize: this.incomeTotal,
          vip: this.incomeValue,
          startTime: this.incomeStartTime,
          endTime: this.incomeEndTime,
          sort: this.incomeSrot,
        }).then((res) => {
          // console.log(res);
          if (res.code == 0) {
            require.ensure([], () => {
              const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
              const tHeader = ["用户id"];
              const filterVal = ["id_code"];
              const list = res.data.list;
              const data = this.formatJson(filterVal, list);
              export_json_to_excel(tHeader, data, "收入榜用户id"); //最后一个是表名字
            });
          }
        });
      } else if (name == "拉新榜") {
        if (this.sex == 1) {
          userProreword({
            page: this.newPage,
            pageSize: this.newTotal,
            vip: this.newValue,
            startTime: this.newStartTime,
            endTime: this.newEndTime,
            sort: this.newSrot,
            sex: 1,
          }).then((res) => {
            // console.log(res);
            if (res.code == 0) {
              require.ensure([], () => {
                const {
                  export_json_to_excel,
                } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
                const tHeader = ["用户id"];
                const filterVal = ["id_code"];
                const list = res.data.list;
                const data = this.formatJson(filterVal, list);
                export_json_to_excel(tHeader, data, "拉新榜男用户id"); //最后一个是表名字
              });
            }
          });
        } else {
          userProreword({
            page: this.newPage,
            pageSize: this.newTotal,
            vip: this.newValue,
            startTime: this.newStartTime,
            endTime: this.newEndTime,
            sort: this.newSrot,
            sex: 2,
          }).then((res) => {
            if (res.code == 0) {
              require.ensure([], () => {
                const {
                  export_json_to_excel,
                } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
                const tHeader = ["用户id"];
                const filterVal = ["id_code"];
                const list = res.data.list;
                const data = this.formatJson(filterVal, list);
                export_json_to_excel(tHeader, data, "拉新榜女用户id"); //最后一个是表名字
              });
            }
          });
        }
      }
    },
    formatJson(filterVal, jsonData) {
      return jsonData.map((v) => filterVal.map((j) => v[j]));
    },
    // 拉新榜男女点击
    handleClickSex(num) {
      this.sex = num;
      this.newTableData = [];
      this.userProreword();
      this.index = num;
      //   console.log(num);
    },
    handleClick(tab) {
      console.log(tab.label);
      if (tab.label == "收入榜") {
        this.incomePage = 1;
        this.userWithdrawal();
      } else if (tab.label == "拉新榜") {
        this.newPage = 1;
        this.userProreword();
      } else if (tab.label == "充值榜") {
        this.page = 1;
        this.Recharge();
      }
    },
    // 分页
    getList() {
      this.Recharge();
    },
    //
    incomeGetList() {
      this.userWithdrawal();
    },
    newGetList() {
      this.userProreword();
    },
    // 搜索
    go(name) {
      console.log(this.vip, this.sort);

      this.startTime = this.time[0];
      this.endTime = this.time[1];
      this.incomeStartTime = this.incomeTime[0];
      this.incomeEndTime = this.incomeTime[1];
      this.newStartTime = this.newTime[0];
      this.newEndTime = this.newTime[1];
      if (name == "充值榜") {
        this.Recharge();
      } else if (name == "收入榜") {
        this.userWithdrawal();
      } else if (name == "拉新榜") {
        this.userProreword();
      }
    },

    // 详情
    details(row) {
      // console.log(row);
      this.$router.push({
        path: "/UserManagement/UserDetails",
        query: { id: row.id_code },
      });
    },
    // 充值榜列表接口
    Recharge() {
      this.loading = true;
      userRechargeList({
        page: this.page,
        pageSize: this.pageSize,
        vip: this.vip,
        startTime: this.startTime,
        endTime: this.endTime,
        sort: this.sort,
      }).then((res) => {
        if (res.code == 0) {
          res.data.list.forEach((item) => {
            item.vip = item.vip == 0 ? "否" : "是";
            item.create_time = moment(parseInt(item.create_time) * 1000).format(
              "YYYY-MM-DD HH:mm:ss"
            );
            item.is_del = item.is_del == "0" ? "正常" : "封禁";
          });
          this.tableData = res.data.list;
          this.total = parseInt(res.data.count);
          this.loading = false;
        }
        // console.log(this.tableData);
      });
    },
    // 收入榜列表
    userWithdrawal() {
      this.incomeLoading = true;
      userWithdrawal({
        page: this.incomePage,
        pageSize: this.incomePageSize,
        vip: this.incomeValue,
        startTime: this.incomeStartTime,
        endTime: this.incomeEndTime,
        sort: this.incomeSrot,
      }).then((res) => {
        // console.log(res);
        if (res.code == 0) {
          res.data.list.forEach((item) => {
            item.vip = item.vip == 0 ? "否" : "是";
            // item.create_time = moment().format("YYYY-MM-DD");
            item.create_time = moment(parseInt(item.create_time) * 1000).format(
              "YYYY-MM-DD HH:mm:ss"
            );
            item.is_del =
              item.is_del == "0"
                ? "正常"
                : item.is_del == "1"
                ? "封禁"
                : "删除"; //0 正常 1封禁 2删除
          });
          this.incomeTableData = res.data.list;
          this.incomeTotal = parseInt(res.data.count);
          this.incomeLoading = false;
        }
      });
    },
    // 拉新榜
    userProreword() {
      this.newLoading = true;
      userProreword({
        page: this.newPage,
        pageSize: this.newPageSize,
        vip: this.newValue,
        startTime: this.newStartTime,
        endTime: this.newEndTime,
        sort: this.newSrot,
        sex: this.sex,
      }).then((res) => {
        // console.log(res);
        res.data.list.forEach((item) => {
          item.vip = item.vip == 0 ? "否" : "是";
          // item.create_time = moment().format("YYYY-MM-DD");
          item.create_time = moment(parseInt(item.create_time) * 1000).format(
            "YYYY-MM-DD HH:mm:ss"
          );

          item.is_del =
            item.is_del == "0" ? "正常" : item.is_del == "1" ? "封禁" : "删除"; //0 正常 1封禁 2删除
        });
        this.newTableData = res.data.list;
        this.newTotal = parseInt(res.data.count);
        this.newLoading = false;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.block {
  margin: 20px 0;
}
.tab_pane {
  span {
    margin-left: 10px;
  }
}
.sex {
  display: flex;
  div {
    padding: 10px 20px;
    border-radius: 10px;
  }
  .active {
    background-color: rgb(31, 31, 160);
    color: #fff;
  }
}
</style>